In computer science, a loop invariant is an invariant used to prove properties of loops and, by extension, algorithms employing loops (usually correctness). Informally, a loop invariant is a statement of the conditions that should be true on entry into a loop and that are guaranteed to remain true on every iteration of the loop.
详细百科解释